<?php include("../components/autoload.php"); ?>
<?php include("../components/functions.php"); ?>
<?php include("../../components/connection.php"); ?>

<?php
	@header('Content-Type: text/html; charset=UTF-8'); 

	$team = new Tim(0);
	
	$team->ime = $_POST['name'];

	$team->grb = createImage($_FILES["crest"], 200, "../../media/teams/logo", $team->ime);
	$team->slika = createImage($_FILES["image"], 960, "../../media/teams/header", $team->ime);
	
	$team->insertIntoDb();
	
	var_dump($team);
	
	$teamq = "INSERT INTO ucestvuje (tim, liga) VALUES ((SELECT MAX(id) FROM tim), '".$_POST['league']."')";
	if (mysql_query($teamq)) echo "Dodat tim u sezonu!";
	
	
?>